#pragma once

/************************************************************/
/*  Author:			Michael Mozdzierz						*/
/*	Date:			02/28/2015								*/
/*	Description:	Overload new and delete operators, and  */
/*					redirect them to the memory manager		*/
/*															*/
/************************************************************/
#include "MemoryManager.h"
#include <assert.h>

inline void* operator new(size_t size)
{
	return EdgeUtil::MemoryManager::GetInstance()->Allocate(size);
}

inline void* operator new[](size_t size)
{
	assert(size > 0 && "New cannot be called, passing only a size of 0 bytes");
	return EdgeUtil::MemoryManager::GetInstance()->Allocate(size);
}

inline void operator delete(void* ptr)
{
	EdgeUtil::MemoryManager::GetInstance()->Free(ptr);
}

inline void operator delete[](void* ptr)
{
	EdgeUtil::MemoryManager::GetInstance()->Free(ptr);
}

inline void operator delete[](void* ptr, size_t size)
{
	EdgeUtil::MemoryManager::GetInstance()->Free(ptr);
}